#include <iostream>
#include <vector>
#include <string>
#include <math.h>

using namespace std;

vector<string> h = {"a", "b", "c", "d", "e", "f"};

string reToHex(unsigned int num) {
    string hex;
    if(num == 0) return "";
    hex += reToHex(num / 16);
    hex += num % 16 < 10 ? to_string(num % 16) : h[num % 16 - 10];
    return hex;
}

string toHex(int num){
    if(num == 0) return "0";
    if(num < 0) return reToHex(pow(2, 32) + num);
    return reToHex(num);
}

int main(){
    int num = -1;
    cout << toHex(num) << endl;
    return 0;
}
